package com.project.XXXX.tools;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;

import javax.servlet.http.HttpServletResponse;

import com.project.XXXX.model.tbl_ptjob;
import com.project.XXXX.stringmodel.PtJobForShownWithBlobs;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;

public class ProjectTools {
	 public static void ResponseOut(HttpServletResponse response ,String json){  
			response.setContentType("text/json; charset=utf-8"); 
			PrintWriter out;
			try {
				out = response.getWriter();
				out.write(json);
				out.flush();
				out.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		 
	 }
 public static String getMessage(String phoneNum) throws Exception{
     int validateCode=(int)(Math.random()*10000);
	//TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "23339176", "0b60225d5d16ec980be1289969fbb449");
	AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
	TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "23339176", "0b60225d5d16ec980be1289969fbb449");
	req.setExtend("123456");
	req.setSmsType("normal");
	req.setSmsFreeSignName("身份验证");
	req.setSmsParamString("{\"code\":\""+validateCode+"\",\"product\":\"阿拉丁兼职网\"}");
	req.setRecNum(phoneNum);
	req.setSmsTemplateCode("SMS_7780400");
	AlibabaAliqinFcSmsNumSendResponse rsp;
	
		rsp = client.execute(req);
		System.out.println(rsp.getBody());
        return validateCode+"";
}
 
   PtJobForShownWithBlobs changePtBean(tbl_ptjob tbl_ptjob)
 {
	 
	 return null;
 }

}
